//
//  main.cpp
//  toSec
//
//  Created by ryu on 2021/10/15.
//

#include <iostream>
#include <vector>
using namespace std;
int toSec(string str);

int main(int argc, const char * argv[]) {
    // insert code here...
    toSec("00:1:14");
    return 0;
}

//解析字符串转换成数组
vector<string> split(string a, string b){
    vector<string> result;
    std::string::size_type i = 0;
    std::string::size_type found = a.find(b);
    while (found != std::string::npos){
        result.push_back(a.substr(i, found - i));
        i = found + b.size();
        found = a.find(b, i);
    }
    result.push_back(a.substr(i, a.size() - i));
    return result;
}

int toSec(string str){
    int res;
//    string str = "1:11:15";
    vector<string> result = split(str, ":");
    if(result.size() == 2){
        res = stoi(result[0])*60*60 + stoi(result[1])*60;
    } else if(result.size() == 3){
        res = stoi(result[0])*60*60 + stoi(result[1])*60 + stoi(result[2]);
    }
    cout<<res<<endl;
    return res;
        
};
